home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / c / shufflc.exe / SHUFFELC.DOC < prev    next >
Text File  |  1991-11-06  |  6KB  |  114 lines

  1. Shuffelc shuffels a normal deck of 52 playing cards and deals out a
  2. single hand of cards.  The shuffel-and-deal sequence can be repeated
  3. by providing an optional command line argument (no_times).  The number
  4. of cards dealt defaults to the usual 5-card poker hand which will be
  5. scored as described below.  However, a second optional command line 
  6. argument (hand_size) can change the number of cards dealt to any
  7. desired number from 1 to 52.
  8.  
  9. Incorrect command lines such as:
  10.       shuffelc HELP
  11. will produce the usage screen below:
  12.  
  13. Bad command-line argument HELP
  14. USAGE:  shuffelc  [no_times [hand_size] ]
  15.      Shuffels a 52 card deck and deals a hand of size
  16.      hand_size (default is 5).  Shuffel & deal is repeated
  17.      no_times times (default is 1).
  18.  EXAMPLE: shuffelc
  19.   might give 3 : King-SP Four-CL Four-DI Eight-DI Four-HT
  20.      where 3-Fours rank #3 on Hoyle's scale of 0 (nothing)
  21.      to 9 (Royal Flush).
  22.  
  23. The card shuffel is performed simply by assigning each of the 52 cards
  24. a random number.  The cards are then sorted by this random number to
  25. complete the shuffel.  I've used the sort method of D.L. Shell which
  26. seems to give good in-memory sorts of smaller lists.
  27.  
  28. In addition to its gaming applications, shuffelc can also test your
  29. random number generator.  Normal poker-hand tests simply check the
  30. number of nothing, one-pair, two-pairs etc. combintions of the digits
  31. 0 - 9.  We've got real poker hands, so the comparison is with Hoyle's
  32. Games table below.
  33.  
  34.     Shuffelc Scoring       Hoyle's Games pg. 100               
  35.    Value Count   Pct.     Value     Count   Pct.
  36.        0 4,998   50.0         0 1,302,540   50.1     Nothing
  37.        1 4,252   42.5         1 1,098,240   42.3     One Pair
  38.        2   476    4.8         2   123,552    4.8     Two Pairs
  39.        3   203    2.0         3    54,912    2.1     Three of a Kind
  40.        4    40    0.4         4    10,200    0.4     Straight
  41.        5    19    0.2         5     5,108    0.2     Flush
  42.        6     9    0.1         6     3,744    0.1     Full House
  43.        7     3    0.0         7       624    0.0     Four of a Kind
  44.        8     0                8        36    0.0     Straight Flush
  45.        9     0                9         4    0.0     Royal Flush
  46. Total    10000         Total    2,598,960
  47.  
  48. TEST OUTPUT:
  49.   BSD 4.3 K&R C        Borland C            MicroSoft C        SCO UNIX-V MSC
  50.   0  2466   49.3      0  2498   50.0       0  2439   48.8      0  2530   50.6 
  51.   1  2158   43.2      1  2127   42.5       1  2179   43.6      1  2045   40.9 
  52.   2   235    4.7      2   236    4.7       2   240    4.8      2   276    5.5 
  53.   3   108    2.2      3    99    2.0       3   112    2.2      3    98    2.0 
  54.   4    17    0.3      4    19    0.4       4    17    0.3      4    28    0.6 
  55.   5    12    0.2      5     9    0.2       5     6    0.1      5    12    0.2 
  56.   6     4    0.1      6    11    0.2       6     4    0.1      6    10    0.2 
  57.   7     0             7     1    0.0       7     3    0.1      7     1    0.0 
  58. Tot. 5000       Total    5000       Total     5000      Total     5000
  59.  
  60. COMPILE COMMANDS USED FOR ABOVE:
  61. cc -DBSD43 -o shuffelc shuffelc.c
  62.                 bcc  -DANSIC  shuffelc.c
  63.                                     cl /AL /DANSIC shuffelc.c
  64.                                                         cc -DANSIC  shuffelc.c
  65.     w.howell  CIS 70215,206   11/6/91
  66.  
  67.  
  68.          ----------------end-of-author's-documentation---------------
  69.  
  70.                          Software Library Information:
  71.  
  72.                     This disk copy provided as a service of
  73.  
  74.                            Public (software) Library
  75.  
  76.          We are not the authors of this program, nor are we associated
  77.          with the author in any way other than as a distributor of the
  78.          program in accordance with the author's terms of distribution.
  79.  
  80.          Please direct shareware payments and specific questions about
  81.          this program to the author of the program, whose name appears
  82.          elsewhere in  this documentation. If you have trouble getting
  83.          in touch with the author,  we will do whatever we can to help
  84.          you with your questions. All programs have been tested and do
  85.          run.  To report problems,  please use the form that is in the
  86.          file PROBLEM.DOC on many of our disks or in other written for-
  87.          mat with screen printouts, if possible.  PsL cannot debug pro-
  88.          programs over the telephone, though we can answer questions.
  89.  
  90.          Disks in the PsL are updated  monthly,  so if you did not get
  91.          this disk directly from the PsL, you should be aware that the
  92.          files in this set may no longer be the current versions. Also,
  93.          if you got this disk from another vendor and are having prob-
  94.          lems,  be aware that  some files may have become corrupted or
  95.          lost by that vendor. Get a current, working disk from PsL.
  96.  
  97.          For a copy of the latest monthly software library newsletter
  98.          and a list of the 3,000+ disks in the library, call or write
  99.  
  100.                            Public (software) Library
  101.                                P.O.Box 35705 - F
  102.                             Houston, TX 77235-5705
  103.  
  104.                                 1-800-2424-PSL
  105.                              MC/Visa/AmEx/Discover
  106.  
  107.                           Outside of U.S. or in Texas
  108.                           or for general information,
  109.                               Call 1-713-524-6394
  110.  
  111.                           PsL also has an outstanding
  112.                           catalog for the Macintosh.
  113.  
  114.